package com.shop.controller;


import com.shop.service.ShopFileService;
import io.minio.errors.*;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;

/**
 * <p>
 * 文件表 前端控制器
 * </p>
 *
 * @author lpx610
 * @since 2023-10-31
 */
@RestController
@RequestMapping("/shopFile")
public class ShopFileController {

    @Resource
    private ShopFileService shopFileService;

    @PostMapping("/upload/{bucket}")
    public String upload(@PathVariable("bucket") String bucket, MultipartFile file) throws ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException {
        return shopFileService.upload(bucket, file);
    }

}
